package com.ruoyi.system.order.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单基本信息表
 * @TableName order_basic
 */
@TableName(value ="order_basic")

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class OrderBasic implements Serializable {
    /**
     * 订单ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 订单编号（唯一）
     */
    private String orderNo;

    /**
     * 下单用户ID（C端用户，可扩展关联）
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 商家ID
     */
    @TableField("merchant_id")
    private Long merchantId;
    @TableField("rider_id")

    private Long riderId;

    /**
     * 取餐号码
     */

    private String pickupNumber;

    /**
     * 配送地址
     */
    private String address;

    /**
     * 菜品金额
     */
    private BigDecimal itemsTotal;

    /**
     * 打包费
     */
    private BigDecimal packageFee;

    /**
     * 配送费
     */
    private BigDecimal deliveryFee;

    /**
     * 优惠减免
     */
    private BigDecimal discountFee;

    /**
     * 订单总金额
     */
    private BigDecimal totalAmount;

    /**
     * 下单时间
     */
    private Date orderTime;

    /**
     * 配送状态 1-待骑手接单 2-配送中 3-配送超时 4-待商家退款 5-商家拒绝退款 6-交易成功 7-交易关闭
     */
    private Integer deliveryStatus;

    /**
     * 异常状态  0-无异常 1-未到店预警 2-未离店预警 3-未送达预警 4-超时未到店 5-超时未到达 6-待商家退款 7-商家拒绝退款
     */
    private Integer exceptionStatus;

    /**
     * 承诺最晚送达
     */
    private Date promiseDeliveryTime;

    /**
     * 是否超时 0否 1是
     */
    private Integer isTimeout;
    @TableField("is_exception")
    private Boolean isException;   // true=异常

    /**
     * 超时原因
     */
    private String timeoutReason;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 订单ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 订单ID
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 订单编号（唯一）
     */
    public String getOrderNo() {
        return orderNo;
    }

    /**
     * 订单编号（唯一）
     */
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    /**
     * 下单用户ID（C端用户，可扩展关联）
     */
    public Long getUserId() {
        return userId;
    }

    /**
     * 下单用户ID（C端用户，可扩展关联）
     */
    public void setUserId(Long userId) {
        this.userId = userId;
    }

    /**
     * 商家ID
     */
    public Long getMerchantId() {
        return merchantId;
    }

    /**
     * 商家ID
     */
    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    /**
     * 取餐号码
     */
    public String getPickupNumber() {
        return pickupNumber;
    }

    /**
     * 取餐号码
     */
    public void setPickupNumber(String pickupNumber) {
        this.pickupNumber = pickupNumber;
    }

    /**
     * 配送地址
     */
    public String getAddress() {
        return address;
    }

    /**
     * 配送地址
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * 菜品金额
     */
    public BigDecimal getItemsTotal() {
        return itemsTotal;
    }

    /**
     * 菜品金额
     */
    public void setItemsTotal(BigDecimal itemsTotal) {
        this.itemsTotal = itemsTotal;
    }

    /**
     * 打包费
     */
    public BigDecimal getPackageFee() {
        return packageFee;
    }

    /**
     * 打包费
     */
    public void setPackageFee(BigDecimal packageFee) {
        this.packageFee = packageFee;
    }

    /**
     * 配送费
     */
    public BigDecimal getDeliveryFee() {
        return deliveryFee;
    }

    /**
     * 配送费
     */
    public void setDeliveryFee(BigDecimal deliveryFee) {
        this.deliveryFee = deliveryFee;
    }

    /**
     * 优惠减免
     */
    public BigDecimal getDiscountFee() {
        return discountFee;
    }

    /**
     * 优惠减免
     */
    public void setDiscountFee(BigDecimal discountFee) {
        this.discountFee = discountFee;
    }

    /**
     * 订单总金额
     */
    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    /**
     * 订单总金额
     */
    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    /**
     * 下单时间
     */
    public Date getOrderTime() {
        return orderTime;
    }

    /**
     * 下单时间
     */
    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    /**
     * 配送状态 1-待骑手接单 2-配送中 3-配送超时 4-待商家退款 5-商家拒绝退款 6-交易成功 7-交易关闭
     */
    public Integer getDeliveryStatus() {
        return deliveryStatus;
    }

    /**
     * 配送状态 1-待骑手接单 2-配送中 3-配送超时 4-待商家退款 5-商家拒绝退款 6-交易成功 7-交易关闭
     */
    public void setDeliveryStatus(Integer deliveryStatus) {
        this.deliveryStatus = deliveryStatus;
    }

    /**
     * 异常状态  0-无异常 1-未到店预警 2-未离店预警 3-未送达预警 4-超时未到店 5-超时未到达 6-待商家退款 7-商家拒绝退款
     */
    public Integer getExceptionStatus() {
        return exceptionStatus;
    }

    /**
     * 异常状态  0-无异常 1-未到店预警 2-未离店预警 3-未送达预警 4-超时未到店 5-超时未到达 6-待商家退款 7-商家拒绝退款
     */
    public void setExceptionStatus(Integer exceptionStatus) {
        this.exceptionStatus = exceptionStatus;
    }

    /**
     * 承诺最晚送达
     */
    public Date getPromiseDeliveryTime() {
        return promiseDeliveryTime;
    }

    /**
     * 承诺最晚送达
     */
    public void setPromiseDeliveryTime(Date promiseDeliveryTime) {
        this.promiseDeliveryTime = promiseDeliveryTime;
    }

    /**
     * 是否超时 0否 1是
     */
    public Integer getIsTimeout() {
        return isTimeout;
    }

    /**
     * 是否超时 0否 1是
     */
    public void setIsTimeout(Integer isTimeout) {
        this.isTimeout = isTimeout;
    }

    /**
     * 超时原因
     */
    public String getTimeoutReason() {
        return timeoutReason;
    }

    /**
     * 超时原因
     */
    public void setTimeoutReason(String timeoutReason) {
        this.timeoutReason = timeoutReason;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OrderBasic other = (OrderBasic) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId()))
            && (this.getPickupNumber() == null ? other.getPickupNumber() == null : this.getPickupNumber().equals(other.getPickupNumber()))
            && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
            && (this.getItemsTotal() == null ? other.getItemsTotal() == null : this.getItemsTotal().equals(other.getItemsTotal()))
            && (this.getPackageFee() == null ? other.getPackageFee() == null : this.getPackageFee().equals(other.getPackageFee()))
            && (this.getDeliveryFee() == null ? other.getDeliveryFee() == null : this.getDeliveryFee().equals(other.getDeliveryFee()))
            && (this.getDiscountFee() == null ? other.getDiscountFee() == null : this.getDiscountFee().equals(other.getDiscountFee()))
            && (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount()))
            && (this.getOrderTime() == null ? other.getOrderTime() == null : this.getOrderTime().equals(other.getOrderTime()))
            && (this.getDeliveryStatus() == null ? other.getDeliveryStatus() == null : this.getDeliveryStatus().equals(other.getDeliveryStatus()))
            && (this.getExceptionStatus() == null ? other.getExceptionStatus() == null : this.getExceptionStatus().equals(other.getExceptionStatus()))
            && (this.getPromiseDeliveryTime() == null ? other.getPromiseDeliveryTime() == null : this.getPromiseDeliveryTime().equals(other.getPromiseDeliveryTime()))
            && (this.getIsTimeout() == null ? other.getIsTimeout() == null : this.getIsTimeout().equals(other.getIsTimeout()))
            && (this.getTimeoutReason() == null ? other.getTimeoutReason() == null : this.getTimeoutReason().equals(other.getTimeoutReason()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getMerchantId() == null) ? 0 : getMerchantId().hashCode());
        result = prime * result + ((getPickupNumber() == null) ? 0 : getPickupNumber().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getItemsTotal() == null) ? 0 : getItemsTotal().hashCode());
        result = prime * result + ((getPackageFee() == null) ? 0 : getPackageFee().hashCode());
        result = prime * result + ((getDeliveryFee() == null) ? 0 : getDeliveryFee().hashCode());
        result = prime * result + ((getDiscountFee() == null) ? 0 : getDiscountFee().hashCode());
        result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode());
        result = prime * result + ((getOrderTime() == null) ? 0 : getOrderTime().hashCode());
        result = prime * result + ((getDeliveryStatus() == null) ? 0 : getDeliveryStatus().hashCode());
        result = prime * result + ((getExceptionStatus() == null) ? 0 : getExceptionStatus().hashCode());
        result = prime * result + ((getPromiseDeliveryTime() == null) ? 0 : getPromiseDeliveryTime().hashCode());
        result = prime * result + ((getIsTimeout() == null) ? 0 : getIsTimeout().hashCode());
        result = prime * result + ((getTimeoutReason() == null) ? 0 : getTimeoutReason().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", orderNo=").append(orderNo);
        sb.append(", userId=").append(userId);
        sb.append(", merchantId=").append(merchantId);
        sb.append(", pickupNumber=").append(pickupNumber);
        sb.append(", address=").append(address);
        sb.append(", itemsTotal=").append(itemsTotal);
        sb.append(", packageFee=").append(packageFee);
        sb.append(", deliveryFee=").append(deliveryFee);
        sb.append(", discountFee=").append(discountFee);
        sb.append(", totalAmount=").append(totalAmount);
        sb.append(", orderTime=").append(orderTime);
        sb.append(", deliveryStatus=").append(deliveryStatus);
        sb.append(", exceptionStatus=").append(exceptionStatus);
        sb.append(", promiseDeliveryTime=").append(promiseDeliveryTime);
        sb.append(", isTimeout=").append(isTimeout);
        sb.append(", timeoutReason=").append(timeoutReason);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}